package com.ykw.parking.mapper;

import com.ykw.parking.pojo1.Parking;
import com.ykw.parking.pojo1.ParkingLot;
import com.ykw.parking.pojo1.UserParking;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Mapper
@Repository
public interface ParkingMapper {
     ArrayList<Parking> queryByAddress(String address);
/*     @Select("select id from parking_one where address like `%${address}%`")
     ArrayList<Integer> queryParkingByAddress(String address);
     @Select("select count(id) from parking_one where address like `%${address}%`")
     Integer queryParkingByAddressInt(String address);*/
     @Select("select * from parking_lot where pid=#{pid} and sale=0 and open=1")
     ArrayList<ParkingLot> queryParkingLotByPid(String pid);
     Parking queryByParkingId(String id);
     void setReserve(String parkingid,String flag);

     @Select("select * from parking_lot where id=#{id}")
     ParkingLot queryParkingLotById(@Param("id") Integer id);

     @Select("select address from parking_one where id=#{id}")
     String queryParkingCity(@Param("id") Integer id);

     @Select("select * from parking_lot where pid=#{pid} and sale=0 and open=0")
     ArrayList<ParkingLot> queryParkingLotByPid1(String pid);



     @Select("select * from user_parking where uid=#{uid}")
     public List<UserParking> pps(String uid);

}
